#tag Window
Begin Window PlayMarksWin
   BackColor       =   16777215
   Backdrop        =   ""
   CloseButton     =   True
   Composite       =   False
   Frame           =   7
   FullScreen      =   False
   HasBackColor    =   False
   Height          =   300
   ImplicitInstance=   True
   LiveResize      =   False
   MacProcID       =   0
   MaxHeight       =   32000
   MaximizeButton  =   False
   MaxWidth        =   32000
   MenuBar         =   ""
   MenuBarVisible  =   True
   MinHeight       =   64
   MinimizeButton  =   False
   MinWidth        =   64
   Placement       =   0
   Resizeable      =   False
   Title           =   "Soittokohdat"
   Visible         =   True
   Width           =   261
   Begin Listbox Listbox1
      AutoDeactivate  =   True
      AutoHideScrollbars=   True
      Bold            =   ""
      Border          =   True
      ColumnCount     =   2
      ColumnsResizable=   ""
      ColumnWidths    =   "40%,60%"
      DataField       =   ""
      DataSource      =   ""
      DefaultRowHeight=   -1
      Enabled         =   True
      EnableDrag      =   ""
      EnableDragReorder=   ""
      GridLinesHorizontal=   0
      GridLinesVertical=   0
      HasHeading      =   ""
      HeadingIndex    =   -1
      Height          =   251
      HelpTag         =   ""
      Hierarchical    =   ""
      Index           =   -2147483648
      InitialParent   =   ""
      InitialValue    =   ""
      Italic          =   ""
      Left            =   20
      LockBottom      =   ""
      LockedInPosition=   False
      LockLeft        =   True
      LockRight       =   ""
      LockTop         =   True
      RequiresSelection=   ""
      Scope           =   0
      ScrollbarHorizontal=   ""
      ScrollBarVertical=   True
      SelectionType   =   0
      TabIndex        =   0
      TabPanelIndex   =   0
      TabStop         =   True
      TextFont        =   "System"
      TextSize        =   0
      TextUnit        =   0
      Top             =   14
      Underline       =   ""
      UseFocusRing    =   True
      Visible         =   True
      Width           =   221
      _ScrollWidth    =   -1
   End
   Begin BevelButton removeBB
      AcceptFocus     =   False
      AutoDeactivate  =   True
      BackColor       =   0
      Bevel           =   0
      Bold            =   False
      ButtonType      =   0
      Caption         =   "Remove"
      CaptionAlign    =   3
      CaptionDelta    =   0
      CaptionPlacement=   1
      Enabled         =   True
      HasBackColor    =   False
      HasMenu         =   0
      Height          =   22
      HelpTag         =   ""
      Icon            =   ""
      IconAlign       =   0
      IconDX          =   0
      IconDY          =   0
      Index           =   -2147483648
      InitialParent   =   ""
      Italic          =   False
      Left            =   20
      LockBottom      =   ""
      LockedInPosition=   False
      LockLeft        =   True
      LockRight       =   ""
      LockTop         =   True
      MenuValue       =   0
      Scope           =   0
      TabIndex        =   2
      TabPanelIndex   =   0
      TabStop         =   True
      TextColor       =   0
      TextFont        =   "System"
      TextSize        =   ""
      TextUnit        =   0
      Top             =   270
      Underline       =   False
      Value           =   False
      Visible         =   True
      Width           =   60
   End
   Begin BevelButton closeBB
      AcceptFocus     =   False
      AutoDeactivate  =   True
      BackColor       =   0
      Bevel           =   0
      Bold            =   False
      ButtonType      =   0
      Caption         =   "Close"
      CaptionAlign    =   3
      CaptionDelta    =   0
      CaptionPlacement=   1
      Enabled         =   True
      HasBackColor    =   False
      HasMenu         =   0
      Height          =   22
      HelpTag         =   ""
      Icon            =   ""
      IconAlign       =   0
      IconDX          =   0
      IconDY          =   0
      Index           =   -2147483648
      InitialParent   =   ""
      Italic          =   False
      Left            =   181
      LockBottom      =   ""
      LockedInPosition=   False
      LockLeft        =   True
      LockRight       =   ""
      LockTop         =   True
      MenuValue       =   0
      Scope           =   0
      TabIndex        =   3
      TabPanelIndex   =   0
      TabStop         =   True
      TextColor       =   0
      TextFont        =   "System"
      TextSize        =   ""
      TextUnit        =   0
      Top             =   270
      Underline       =   False
      Value           =   False
      Visible         =   True
      Width           =   60
   End
End
#tag EndWindow

#tag WindowCode
	#tag Event
		Sub Open()
		  me.left=SCREEN(0).WIDTH/2-me.width/2
		  me.top=100
		  
		  app.lang.LoadCaptions(self)
		End Sub
	#tag EndEvent


	#tag Method, Flags = &h0
		Sub Update()
		  LIstbox1.columntype(1)=listbox.TypeEditableTextField
		  
		  listbox1.deleteallrows
		  
		  if mainwin.TheSong<>nil then
		    for i as integer=1 to CountFields(mainwin.TheSong.PLAYMARKSDATA,"|")
		      
		      Listbox1.addrow NthField(NthField(mainwin.TheSong.PLAYMARKSDATA,"|",i),";",1)
		      Listbox1.cell(listbox1.lastindex,1)=NthField(NthField(mainwin.TheSong.PLAYMARKSDATA,"|",i),";",2)
		      
		    next
		  end
		  
		  Listbox1.SortedColumn=1
		  Listbox1.ColumnSortDirection(0)=1
		  Listbox1.sort
		End Sub
	#tag EndMethod


	#tag Property, Flags = &h0
		TargetTime As Integer
	#tag EndProperty


#tag EndWindowCode

#tag Events removeBB
	#tag Event
		Sub Action()
		  if Listbox1.listindex>-1 then
		    Listbox1.removerow(listbox1.listindex)
		  end
		End Sub
	#tag EndEvent
#tag EndEvents
#tag Events closeBB
	#tag Event
		Sub Action()
		  dim s as string
		  
		  if mainwin.thesong<>nil then
		    
		    for i as integer=0 to Listbox1.listcount-1
		      if i=0 then
		        s=listbox1.cell(i,0)+";"+listbox1.cell(i,1)
		      else
		        s=s+"|"+listbox1.cell(i,0)+";"+listbox1.cell(i,1)
		      end
		    next
		    
		    mainwin.thesong.PLAYMARKSDATA=s
		    
		  end
		  
		  do
		  loop until mainwin.thesong.UpdateField("PLAYMARKSDATA")
		  
		  mainwin.UpdateView
		  
		  close
		End Sub
	#tag EndEvent
#tag EndEvents
